package car.aistar.service.impl;

import car.aistar.dao.XXRxiaohsou;
import car.aistar.dto.XXRyuyue;

import car.aistar.dto.XxrCarDto;
import car.aistar.dto.XxrRecordDto;
import car.aistar.dto.Xxrkanjia;
import car.aistar.service.XXRxiaoshouService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName XXRxiaoshouService
 * @Description TODO
 * @Author 肖
 * @Date 2020/10/4 20:01
 * Version 1.0
 **/
@Service("XXRxiaoshou")
public class XXRxiaoshou implements XXRxiaoshouService {
    @Resource
    private XXRxiaohsou xxRxiaohsou;

//    /**
//    *@Author 肖相荣
//    *@Description //TODO 销售页面预约表根据预约表中carID进行删除预约记录lmpl
//    *@Date 17:52 2020/10/5
//    *@Param [id]
//    *@return void
//    **/
//    @Override
//    public void delByCarId (Long id){
//        xxRxiaohsou.delByCarId(id);
//    }

    @Override
    public List<XXRyuyue> findAllYuyue (Long id,String search){
        return xxRxiaohsou.findAllYuyue(id,search);
    }

    @Override
    public PageInfo<XXRyuyue> findByPageyuye (Long id, String search, Integer pageNow, Integer pageSize){
            PageHelper.startPage(pageNow,pageSize);
            List<XXRyuyue> xxRyuyues = xxRxiaohsou.findAllYuyue(id, search);
            PageInfo<XXRyuyue> petPageInfo = new PageInfo<>(xxRyuyues);
            return petPageInfo;
    }

    @Override
    public PageInfo<XXRyuyue> findByPageYok (Long id, String search, Integer pageNow, Integer pageSize){
        PageHelper.startPage(pageNow,pageSize);
        List<XXRyuyue> xxRyuyues = xxRxiaohsou.findAllYok(id, search);
        PageInfo<XXRyuyue> petPageInfo = new PageInfo<>(xxRyuyues);
        return petPageInfo;
    }

    @Override
    public PageInfo<Xxrkanjia> findByPagekanjia (Long id, String search, Integer pageNow, Integer pageSize){
        PageHelper.startPage(pageNow,pageSize);
        List<Xxrkanjia> xxrkanjias = xxRxiaohsou.findAllKanjia(id,search);
        PageInfo<Xxrkanjia> petPageInfo = new PageInfo<>(xxrkanjias);
        return petPageInfo;
    }

    @Override
    public PageInfo<XxrCarDto> findByPageCar (Long id, String search, Integer pageNow, Integer pageSize){
        PageHelper.startPage(pageNow,pageSize);
        List<XxrCarDto> xxrCarDtos = xxRxiaohsou.findAllCar(id,search);
        PageInfo<XxrCarDto> petPageInfo = new PageInfo<>(xxrCarDtos);
        return petPageInfo;
    }

    @Override
    public void delKanjia (Long id){
        xxRxiaohsou.delKanjia(id);
    }

    @Override
    public List<XxrRecordDto> findAllRecord (Long id, String search){
        return xxRxiaohsou.findAllRecord(id,"");
    }

    @Override
    public PageInfo<XxrRecordDto> findByPageRecord (Long id, String search, Integer pageNow, Integer pageSize){
        PageHelper.startPage(pageNow,pageSize);
        List<XxrRecordDto> xxrRecordDtos = xxRxiaohsou.findAllRecord(id,search);
        PageInfo<XxrRecordDto> petPageInfo = new PageInfo<>(xxrRecordDtos);
        return petPageInfo;
    }
}
